<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />
    <title>z-UI-code</title>
    <link rel="stylesheet" type="text/css" href="font-awesome-4.7.0/css/font-awesome.min.css"/>
    <link rel="stylesheet" type="text/css" href="z-UI.css"/>
    <link rel="stylesheet" type="text/css" href="z-UI-alert/css/z-UI.alert.css"/>
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript" src="z-UI.js"></script>
    <script type="text/javascript" src="z-UI-alert/js/z-UI.alert.js"></script>
    <style>

    </style>
</head>
<body class="zUI-app">

<div class="zUI-full" style="overflow-y: auto;overflow-x: hidden;padding: 20px;">
    <span>一个代码段</span>
    <pre class="zUI-code" id="code1">
public static void main(){
    String a = 1;
    System.out.println(a);
}
    </pre>
    <span>一个代码段</span>
    <pre class="zUI-code" id="code2">
    </pre>

</div>
</body>

<script>
    $(function () {
        zUI.code.render({
            elem:'#code1',
        });
        zUI.code.render({
            elem:'#code2',
            value:'package com.sinitek.reportactiviti.excelcheck.pool;\n' +
                '\n' +
                'import com.sinitek.rhindi.pool.RhCheckRulePool;\n' +
                '\n' +
                'import java.util.HashMap;\n' +
                'import java.util.Map;\n' +
                'import java.util.concurrent.Callable;\n' +
                '\n' +
                '/**\n' +
                ' * 线程的同步任务\n' +
                ' */\n' +
                'public abstract class SynJob implements Callable<Map<String,Object>> {\n' +
                '    /**\n' +
                '     * 任务id\n' +
                '     */\n' +
                '    protected String id;\n' +
                '    /**\n' +
                '     * 任务名称\n' +
                '     */\n' +
                '    protected String name;\n' +
                '    /**\n' +
                '     * 任务耗时\n' +
                '     */\n' +
                '    protected Long spendTime = 0L;\n' +
                '    /**\n' +
                '     * 任务状态 0-未开始 1-执行中 2-执行结束\n' +
                '     */\n' +
                '    protected int status = 0;\n' +
                '    /**\n' +
                '     * 引用计数器\n' +
                '     */\n' +
                '    protected int cnt = 1;\n' +
                '    /**\n' +
                '     * 任务返回的数据\n' +
                '     */\n' +
                '    protected Map<String,Object> res = new HashMap<>(1);\n' +
                '    @Override\n' +
                '    public Map<String,Object> call() throws Exception{\n' +
                '        long start = System.currentTimeMillis();\n' +
                '        try{\n' +
                '            status = 1;\n' +
                '            this.run();\n' +
                '        }finally {\n' +
                '            status = 2;\n' +
                '        }\n' +
                '\n' +
                '        spendTime = System.currentTimeMillis() - start;\n' +
                '        return res;\n' +
                '    }\n' +
                '    public abstract void run() throws Exception;\n' +
                '\n' +
                '    /*public SynJob(String name) {\n' +
                '        this.name = name;\n' +
                '    }*/\n' +
                '    public SynJob(String id,String name) {\n' +
                '        this.id = id;\n' +
                '        this.name = name;\n' +
                '    }\n' +
                '\n' +
                '    public String getName() {\n' +
                '        return name;\n' +
                '    }\n' +
                '\n' +
                '    public void setName(String name) {\n' +
                '        this.name = name;\n' +
                '    }\n' +
                '\n' +
                '    public Map<String, Object> getRes() {\n' +
                '        return res;\n' +
                '    }\n' +
                '\n' +
                '    public void set(String k , Object v) {\n' +
                '        res.put(k , v);\n' +
                '    }\n' +
                '\n' +
                '    public Long getSpendTime() {\n' +
                '        return spendTime;\n' +
                '    }\n' +
                '\n' +
                '    public String getId() {\n' +
                '        return id;\n' +
                '    }\n' +
                '\n' +
                '    public void setId(String id) {\n' +
                '        this.id = id;\n' +
                '    }\n' +
                '\n' +
                '    public int getStatus() {\n' +
                '        return status;\n' +
                '    }\n' +
                '\n' +
                '    public int addCnt() {\n' +
                '        return ++ this.cnt;\n' +
                '    }\n' +
                '    public int deleteCnt() {\n' +
                '        return -- this.cnt;\n' +
                '    }\n' +
                '}\n'
        });
    })

</script>


</html>